import $ from '../common';
Page({
  data: {
    titleHeight: $.gData().titleHeight,
    statuHeight: $.gData().statuHeight,
    info: {
      funtit: '暂无需要布置点评的班级',
      tiptit: '请选择需要点评的班级',
      id: 1
    },
    page:1,
    classinfo:[],
    tip:'下拉加载更多'
  },
  itemclick(tmp){//每一项的跳转
    $.navigateTo(`/Signin/classreview?group_uuid=${tmp.detail}`)
  },
  onReachBottom(){//下来
    console.log('触底了！！！');
    this.getinfo()
  },
  getinfo(){//
    const{page,classinfo}=this.data
    $.get('/teacher/groups',{
      limit:20,
      page:page
    },res=>{
      if(res.groups.length<20){
        this.data.tip='已经到底了'
      }else{
        this.data.tip='下拉加载更多'
      }
      this.data.page++
      this.setData({
        classinfo:[...classinfo,...res.groups],
        tip:this.data.tip
      })
    })
  },
  onLoad(e) {
    this.getinfo()
  },
  onShow() {}
})